import React, {useEffect, useState} from 'react';
import logo from '@/assets/logo.svg';
import './App.css'

function Home() {
  // 声明一个叫 "count" 的 state 变量
  const [count, setCount] = useState(0);

  // Similar to componentDidMount and componentDidUpdate:
  useEffect(() => {
    // Update the document title using the browser API
    document.title = `You clicked ${count} times`;
  }, [count]);

  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo"/>
        <div>
          <p>You clicked {count} times</p>
          <button onClick={() => setCount(count + 1)}>
            Click me
          </button>
        </div>
      </header>
    </div>
  );
}
export default React.memo(Home)
